<template>
	<view>
	<cu-custom bgColor="bg-gradual-pink" :isBack="true"><block slot="backText">返回</block>
		<block slot="content">已报名</block>
	</cu-custom>
	
	<view class="cu-bar  search flex">
		<view class="flex-fiv padding-t">
			<view class="search-form round">
				<text class="cuIcon-search"></text>
				<input type="text" placeholder="输入搜索的关键词" v-model="searchval" @blur="search_cs" confirm-type="search"></input>
			</view>
		</view>
	</view>
	
	<view class="ybm-info">
		<view class="ybm-unum">已报名:{{perusers==null?0:perusers.length}}队</view>
		<view class="ybm-list" v-for="(item,index) in perusers" :key="index">
			<view class="ybm-um flex">
				<view class="ybm-um-index">{{index+1}}</view>
				<view class="ybm-um-name">{{item.name}}</view>
				<view class="ybm-um-tel">{{item.tel}}</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		onLoad(option){
			this.mid=option.mid;
			this.userid=uni.getStorageSync("uid");
			this.openid=uni.getStorageSync('openid');
			
		},
		onShow() {
			uni.showLoading({
				title:'加载中..'
			})
			uni.request({
				url:"https://www.52tennis.cn/Match/GetMatchTeamJoin",
				data: {
					matchid:this.mid,
					pagesize:100,
					currpage:1,
					name:this.searchval
				},
				success:(data)=> {
					console.log(data);
					if(data.data.result==1){
						this.perusers=data.data.returnjson
					}else{
						this.perusers=null;
					}
				},complete:()=>{
					uni.hideLoading();
				}
			})
		},
		data() {
			return {
				mid:0,
				perusers:[],
				searchval:''
			}
		},
		methods: {
			search_cs(e){
				uni.showLoading({
					title:'加载中..'
				});
				uni.request({
					url:"https://www.52tennis.cn/Match/GetMatchTeamJoin",
					data: {
						matchid:this.mid,
						pagesize:100,
						currpage:1,
						name:this.searchval
					},
					success:(data)=> {
						//uni.hideLoading();
						console.log(data);
						if(data.data.result==1){
							this.perusers=data.data.returnjson
						}else{
							this.perusers=null;
						}
					},
					complete:()=>{
						uni.hideLoading();
					}
				})
			}
		}
	}
</script>

<style>
	.ybm-info{
		padding:30rpx 60rpx;
	}
	.ybm-unum{
		padding-bottom: 20rpx;
	}
	.ybm-um{
		border: 1rpx solid #808080;
		border-bottom: none;
		height: 45rpx;
		line-height: 45rpx;
		text-align: center;
	}
	.ybm-list:last-child .ybm-um{
		border-bottom: 1rpx solid #808080;
	}
	.ybm-um-index{
		width:10%;
		border-right: 1rpx solid #808080;
	}
	.ybm-um-name{
		width:50%;
	}
</style>
